import request from '@/utils/request'

// 企业列表
export const getEnterPriseApi = (params) => {
  return request.get('/park/enterprise', { params })
}
// 企业中所属行业列表，下拉框
export const getIndustryListApi = () => {
  return request.get('/park/industry')
}
// 下载执照
export const uploadApi = (data) => {
  return request.post('/upload', data)
}
// 新增企业
export const createEnterpriseAPI = (data) => {
  return request.post('/park/enterprise', data)
}

// 查询企业详情
export const getEnterpriseDetailAPI = (id) => {
  return request.get(`/park/enterprise/${id}`)
}
// 编辑修改企业
export const updateEnterpriseAPI = (data) => {
  return request.put('/park/enterprise', data)
}

// 删除企业
export const delEnterpriseAPI = (id) => {
  return request.delete(`/park/enterprise/${id}`)
}

/**
 * 获取空置中楼宇列表（未租赁）
 */
export const getRentBuildListAPI = (params) => {
  return request.get('/park/rent/building', { params })
}

/**
 * 给当前企业添加合同
 */
export const createRentAPI = (data) => {
  return request.post('/park/enterprise/rent', data)
}

/**
 * 获取企业下合同列表
 */
export const getRentListAPI = (id) => {
  return request.get(`/park/enterprise/rent/${id}`)
}

/**
 * 退租
 */

export const outRentAPI = (rentId) => {
  return request.put(`/park/enterprise/rent/${rentId}`)
}

/**
 * 下载合同文件
 */
export const downloadContractApi = (id) => {
  return request.get(`/download/${id}`, {
    responseType: 'blob'
  })
}
